package com.chixing.day04_oop;
/*
    JavaBean:(1)无参构造函数 +（2） get，set方法
*/
public class Car {
    private int carId;
    private String carName;
    private String carBrand;
    private String carColor;

    public int getCarId() {
        return carId;
    }

    public void setCarId(int carId) {
        this.carId = carId;
    }

    public String getCarName() {
        return carName;
    }

    public void setCarName(String carName) {
        this.carName = carName;
    }

    public String getCarBrand() {
        return carBrand;
    }

    public void setCarBrand(String carBrand) {
        this.carBrand = carBrand;
    }

    public String getCarColor() {
        return carColor;
    }

    public void setCarColor(String carColor) {
        this.carColor = carColor;
    }

    //默认省略 无参构造函数
    public Car(){}

    /*如果已经定义了 有参构造函数，则会把 默认的无参构造函数 覆盖，
       如果还想使用无参构造函数，只能把无参构造函数定义出来*/
    //有参构造函数：alt + insert
    public Car(int carId, String carName) {
        this.carId = carId;
        this.carName = carName;
    }

    public Car(int carId, String carName, String carBrand, String carColor) {
        this(carId,carName);//调用 当前类 其他构造函数
        this.carBrand = carBrand;
        this.carColor = carColor;
    }


    public Car fun1(){
        return null;
    }
    public Car fun2(){
        return new Car();
    }
    public Car fun3(){
        return this;
    }




}
